package com.demo.designmode.visitor;

/**
 * @Author: jxm
 * @Description: 访问者模式测试
 * @Date: 2023-12-12 15:39
 * @Version: 1.0
 */
public class Client {
    public static void main(String[] args) {
        //创建home对象
        Home home = new Home();
        //添加元素
        home.add(new Cat());
        home.add(new Dog());

        //创建主人对象
        Owner owner = new Owner();
        //让主人喂食所有宠物
        home.action(owner);

        Someone someone = new Someone();
        home.action(someone);
    }
}
